package com.lsc.service;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;

public class FileUtil {
	public static String readTxt(File file) throws IOException {
		String s = "";
		InputStreamReader in = new InputStreamReader(new FileInputStream(file), "UTF-8");
		BufferedReader br = new BufferedReader(in);
		StringBuffer content = new StringBuffer();
		while ((s = br.readLine()) != null) {
			content = content.append(s);
		}
		return content.toString();
	}

	public static void writerTxt(File file, String str) throws IOException {
		FileWriter writer = new FileWriter(file, false);
		writer.write(str);
		writer.close();
	}
}
